package com.laomou.logdog.loginfo;


import com.laomou.logdog.controller.MainController;

public class LoginfoExceptionParser {
    private int m_nExceptionType = 0;
    private RuntimeExceptionParser runtimeExceptionParser;
    private AnrExceptionParser anrExceptionParser;

    public LoginfoExceptionParser() {
        runtimeExceptionParser = new RuntimeExceptionParser();
        anrExceptionParser = new AnrExceptionParser();
    }

    public boolean processLogE(LogInfo logInfo) {
        if ((m_nExceptionType & MainController.EXCEPTION_ANR) != 0
                && anrExceptionParser.processLogE(logInfo)) {
            return true;
        }
        if ((m_nExceptionType & MainController.EXCEPTION_RUNE) != 0
                && runtimeExceptionParser.processLogE(logInfo)) {
            return true;
        }
        if ((m_nExceptionType & MainController.EXCEPTION_ALL) != 0
                && anrExceptionParser.processLogE(logInfo)
                && runtimeExceptionParser.processLogE(logInfo)) {
            return true;
        }
        return false;
    }

    public void setExceptionType(int exceptionType) {
        this.m_nExceptionType = exceptionType;
    }
}
